﻿// -------------------------------------------------------------------------
//    @FileName         :    NFTradePart.cpp
//    @Author           :    gaoyi
//    @Date             :    24-8-30
//    @Email            :    445267987@qq.com
//    @Module           :    NFTradePart
//
// -------------------------------------------------------------------------

#include "NFTradePart.h"

#include "proto_db.pb.h"

NFTradePart::NFTradePart()
{
    if (EN_OBJ_MODE_INIT == NFShmMgr::Instance()->GetCreateMode())
    {
        CreateInit();
    }
    else
    {
        ResumeInit();
    }
}

NFTradePart::~NFTradePart()
{
}

int NFTradePart::CreateInit()
{
    return 0;
}
    
int NFTradePart::ResumeInit()
{
    return 0;
}

int NFTradePart::LoadFromDB(const proto_ff::tbRoleDetail *pDBData)
{
    m_stData.FromPb(pDBData->role_fortune_data().trade_data());
    return 0;
}

int NFTradePart::InitConfig(proto_ff::tbRoleDetail *pDbData, const RoleOne &stRoleOne)
{
    CHECK_NULL(0, pDbData);
    auto pRoleTradeData = pDbData->mutable_role_fortune_data()->mutable_trade_data();
    CHECK_NULL(0, pRoleTradeData);

    pRoleTradeData->mutable_chamber_data()->set_last_refresh_time( NF_ADJUST_TIMENOW());
    pRoleTradeData->mutable_mall_data()->set_last_refresh_time( NF_ADJUST_TIMENOW());
    return 0;
}

int NFTradePart::SaveDB(proto_ff::tbRoleDetail *pDBData)
{
    m_stData.ToPb(pDBData->mutable_role_fortune_data()->mutable_trade_data());
    return 0;
}

int NFTradePart::MakePlayerDataCS(proto_ff::Proto_CSGetRoleRsp* pCSGetRoleRsp)
{
    return 0;
}

int NFTradePart::MakeCityPlayerData(proto_ff::CityRoleInfo* pGCCityRoleInfo)
{
    return 0;
}

